ostree/main: Wrap `Version` in `--version` in quotes
authorJonathan Lebon <jonathan@jlebon.com>
Wed, 24 Oct 2018 15:15:18 +0000 (11:15 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Wed, 24 Oct 2018 18:46:39 +0000 (18:46 +0000)
Wrap the `Version` key in the YAML-compatible output of
`ostree --version` with quotes so that it's parsed as a string. The
issues with the previous approach in a nutshell:

```
In [5]: yaml.load("asdf: 2018.10")
Out[5]: {'asdf': 2018.1}
```

It's treating the version number as a floating-point. Now, this is
technically a backwards incompatible change, but given that the previous
approach is inherently broken for our needs, I don't see a way around
breaking it now.

Closes: #1761
Approved by: cgwalters

src/ostree/ot-main.c

index 148c8371bd1bbe163cda87e4a2988ee09bce40e3..a1449aef25882a34424bb3b9f95d7d91325113e9 100644 (file)
@@ -354,7 +354,7 @@ ostree_option_context_parse (GOptionContext *context,
        * possible to parse */
       g_auto(GStrv) features = g_strsplit (OSTREE_FEATURES, " ", -1);
       g_print ("%s:\n", PACKAGE_NAME);
-      g_print (" Version: %s\n", PACKAGE_VERSION);
+      g_print (" Version: '%s'\n", PACKAGE_VERSION);
       if (strlen (OSTREE_GITREV) > 0)
         g_print (" Git: %s\n", OSTREE_GITREV);
 #ifdef BUILDOPT_IS_DEVEL_BUILD